package com.netsar.dao;


import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;


public class DAO {

	private EntityManagerFactory emf; 

	public EntityManager getEntityManager(){

	
		try {
			//compatibilidade com tomcat7
			Class.forName("com.mysql.jdbc.Driver").newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

		emf = Persistence.createEntityManagerFactory("ProjetoTeste");
		return emf.createEntityManager();
	}
	
}

